import 'dart:convert';

import 'package:bruno/bruno.dart';
import 'package:dio/dio.dart';
import 'package:easy_refresh/easy_refresh.dart';

import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:imclient/imclient.dart';
import 'package:sph_driver/AppConfig/Config.dart';
import 'package:sph_driver/Authentication/CarCard.dart';
import 'package:sph_driver/Authentication/DriverCard.dart';
import 'package:sph_driver/Authentication/Qualifications.dart';
import 'package:sph_driver/Main/BlackList/BlackList.dart';
import 'package:sph_driver/Main/CustomerService/CustomerServiceMain.dart';
import 'package:sph_driver/Main/Evaluate/MyEvaluation.dart';
import 'package:sph_driver/Main/FindOil/FindOil.dart';
import 'package:sph_driver/Main/FleetManagement/FleetManagement.dart';
import 'package:sph_driver/Main/InformationView.dart';
import 'package:sph_driver/Main/Insure/Insure.dart';
import 'package:sph_driver/Main/MyWallet/MyWallet.dart';
import 'package:sph_driver/Main/PlatformRules/PlatformRules.dart';
import 'package:sph_driver/Main/Settings/SettingList.dart';
import 'package:sph_driver/http/NoLoadingGetApi.dart';

import '../AppConfig/LocalStorage.dart';
import '../AppConfig/RouteAct.dart';
import '../AppConfig/StringEncapsulation.dart';
import '../Authentication/FaceCheckView.dart';
import '../Authentication/IDCard.dart';
import '../http/api.dart';
import '../l10n/messages.dart';
import 'FleetManagement/MyFleet.dart';
import 'ServiceHall/Feedback.dart';

class PersonCenter extends StatefulWidget {
  const PersonCenter({super.key});

  @override
  State<PersonCenter> createState() => _PersonCenterState();
}

class _PersonCenterState extends State<PersonCenter> {
  int checkBill1=1;
  int checkBill2=1;
  int checkBill3=1;
  Map dataMap={};
  Map balanceMap={};
  late EasyRefreshController _controller;
  Future _onRefresh() async {
    getUserMessage();
    getBalance();
  }

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    getUserMessage();
    getBalance();

  }

  @override
  void dispose() {
    super.dispose();
  }
  Future<void> getUserMessage() async {
    NoLoadinggetApiManager.getData(
      context, // 上下文对象，用于显示提示信息等
      'api/auth/driver/user/getLoginUser', // 您的API端点
      {}, // 查询参数，如果没有可以传递null
          (responseData)  {
            setState(() {
              dataMap=responseData['data'];
            });
      },
    );

  }
  void getBalance()  {
    NoLoadinggetApiManager.getData(
      context, // 上下文对象，用于显示提示信息等
      'api/pay/driver/user/balanceInfo', // 您的API端点
      {}, // 查询参数，如果没有可以传递null
          (responseData)  {
        setState(() {
          if(responseData['data']!=null)
          balanceMap=responseData['data'];
        });
      },
    );

  }
  @override
  Widget build(BuildContext context) {
    final screenSize = MediaQuery.of(context).size;
    var messages = AppLocalizations.of(context)!;
    return Scaffold(
      backgroundColor: MyColors.backgreyColor,
      body: EasyRefresh(
        header: ClassicHeader(
          dragText: '下拉刷新',
          armedText: '准备释放',
          readyText: '加载中...',
          processingText: '加载中...',
          processedText: '刷新成功',
          noMoreText: '暂无更多',
          failedText: '刷新失败',
          messageText: '刷新时间 %T',
        ),
          onRefresh: _onRefresh,
          child:   ListView(
            children: [

              Column(
                children: [
                  Row(
                    mainAxisAlignment: MainAxisAlignment.end,
                    children: [
                      BrnIconButton(
                          name: '设置',
                          style: TextStyle(
                            fontSize: 13.sp,
                            color: Colors.black,
                          ),
                          direction: Direction.bottom,
                          padding: 4.h,
                          iconHeight: 18.h,
                          iconWidth: 18.w,
                          iconWidget: Image.asset("lib/Images/PersonCenter/设置icon.png"),
                          onTap: () async {

                            Navigator.push(context,
                                MaterialPageRoute(builder: (context) {
                                  return SettingList(
                                  );
                                }));

                          }),
                    ],
                  ),
                  GestureDetector(
                    child:   Row(
                      mainAxisAlignment: MainAxisAlignment.spaceBetween,
                      children: [
                        Row(
                          children: [
                            SizedBox(width: 8.w,),
                            Container(
                              width: 60.w,
                              height: 60.h,
                              child:  dataMap['avatarPath']!=null&&dataMap['avatarPath']!=""?
                              CircleAvatar(
                                radius: 15,
                                backgroundImage: NetworkImage(MyServiceUrl.imgHeader +dataMap['avatarPath']),
                              )
                                  :  CircleAvatar(
                                radius: 15,
                                backgroundImage: AssetImage("lib/Images/login/默认头像.jpeg"),
                              ),
                            ),


                            SizedBox(width: 8.w,),
                            Column(
                              crossAxisAlignment: CrossAxisAlignment.start,
                              children: [
                                if(dataMap.isNotEmpty)
                                  Row(
                                    children: [
                                      Text(dataMap['realName']!=null?dataMap['realName']:dataMap['phoneNum'],style: TextStyle(color: Colors.black,fontWeight: FontWeight.w600,fontSize:16.sp ),),
                                      SizedBox(width: 8.w,),
                                      if(dataMap['personalStatus']!=2)
                                        Image.asset("lib/Images/PersonCenter/未认证标签.png",width: 44.w,height: 18.h,),
                                      // if(dataMap['personalStatus']==2&&dataMap['driverLicenseStatus']==2&&dataMap['vehicleDrivingLicenseStatus']==2&&(dataMap['qualificationCertificateStatus']!=2||dataMap['roadTransportCertificateStatus']!=2))
                                      //   BrnTagCustom.buildBorderTag(
                                      //     tagText: '三证齐全',
                                      //     textColor: Colors.green,
                                      //     borderColor: Colors.green,
                                      //     borderWidth: 1,
                                      //     fontSize:9.sp,
                                      //     textPadding: EdgeInsets.all(1),
                                      //   ),
                                      // if(dataMap['personalStatus']==2&&dataMap['driverLicenseStatus']==2&&dataMap['vehicleDrivingLicenseStatus']==2&&dataMap['qualificationCertificateStatus']==2&&dataMap['roadTransportCertificateStatus']==2)
                                      //   BrnTagCustom.buildBorderTag(
                                      //     tagText: '五证齐全',
                                      //     textColor: Colors.green,
                                      //     borderColor: Colors.green,
                                      //     borderWidth: 1,
                                      //     fontSize:9.sp,
                                      //     textPadding: EdgeInsets.all(1),
                                      //   ),
                                      // if(dataMap['personalStatus']==2&&(dataMap['driverLicenseStatus']!=2||dataMap['vehicleDrivingLicenseStatus']!=2)&&(dataMap['qualificationCertificateStatus']!=2||dataMap['roadTransportCertificateStatus']!=2))
                                      // // Image.asset("lib/Images/PersonCenter/已认证标签.png",width: 44.w,height: 18.h,),
                                      //   BrnTagCustom.buildBorderTag(
                                      //     tagText: '已认证',
                                      //     textColor: Colors.green,
                                      //     borderColor: Colors.green,
                                      //     borderWidth: 1,
                                      //     fontSize:9.sp,
                                      //     textPadding: EdgeInsets.all(1),
                                      //   )
                                    ],
                                  ),
                                if(dataMap.isNotEmpty&&dataMap['vehicleLength']==null)
                                  Text("车长"+"丨"+"车型",style: TextStyle(color: Color.fromRGBO(102, 102, 102, 1),fontSize: 12.sp),),
                                if(dataMap.isNotEmpty&&dataMap['vehicleLength']!=null)
                                  Text(dataMap['vehicleLength']+"丨"+dataMap['vehicleModel'],style: TextStyle(color: Color.fromRGBO(102, 102, 102, 1),fontSize: 12.sp),),
                                Row(
                                  children: [
                                    Text("身份认证",style: TextStyle(fontSize: 10.sp,color: MyColors.authTipColor,),),
                                    (dataMap['personalStatus']==0||dataMap['personalStatus']==3||dataMap['personalStatus']==null)?

                                    Icon(Icons.
                                    error_outline,color: Colors.red,size: 12,)
                                        :dataMap['personalStatus']==1?

                                    Icon(Icons.access_time,color: MyColors.themeColor,size: 12,)
                                        :
                                    Icon(Icons.check_circle_outline,color: Colors.green,size: 12,),

                                    Text("驾驶证",style: TextStyle(fontSize: 10.sp,color: MyColors.authTipColor,),),
                                    (dataMap['driverLicenseStatus']==0||dataMap['driverLicenseStatus']==3||dataMap['driverLicenseStatus']==null)?

                                    Icon(Icons.
                                    error_outline,color: Colors.red,size: 12,)
                                        :dataMap['driverLicenseStatus']==1?

                                    Icon(Icons.access_time,color: MyColors.themeColor,size: 12,)
                                        :
                                    Icon(Icons.check_circle_outline,color: Colors.green,size: 12,),
                                    Text("从业资格证",style: TextStyle(fontSize: 10.sp,color: MyColors.authTipColor,),),
                                    (dataMap['vehicleDrivingLicenseStatus']==0||dataMap['vehicleDrivingLicenseStatus']==3||dataMap['vehicleDrivingLicenseStatus']==null)?
                                    Icon(Icons.
                                    error_outline,color: Colors.red,size: 12,)
                                        :dataMap['vehicleDrivingLicenseStatus']==1?

                                    Icon(Icons.access_time,color: MyColors.themeColor,size: 12,)
                                        :
                                    Icon(Icons.check_circle_outline,color: Colors.green,size: 12,),
                                  ],
                                ),
                                Row(
                                  children: [
                                    Text("道路运输证",style: TextStyle(fontSize: 10.sp,color: MyColors.authTipColor,),),
                                    (dataMap['roadTransportCertificateStatus']==0||dataMap['roadTransportCertificateStatus']==3||dataMap['roadTransportCertificateStatus']==null)?

                                    Icon(Icons.
                                    error_outline,color: Colors.red,size: 12,)
                                        :dataMap['roadTransportCertificateStatus']==1?

                                    Icon(Icons.access_time,color: MyColors.themeColor,size: 12,)
                                        :
                                    Icon(Icons.check_circle_outline,color: Colors.green,size: 12,),
                                    Text("从业资格证",style: TextStyle(fontSize: 10.sp,color: MyColors.authTipColor,),),
                                    (dataMap['qualificationCertificateStatus']==0||dataMap['qualificationCertificateStatus']==3||dataMap['qualificationCertificateStatus']==null)?

                                    Icon(Icons.
                                    error_outline,color: Colors.red,size: 12,)
                                        :dataMap['qualificationCertificateStatus']==1?

                                    Icon(Icons.access_time,color: MyColors.themeColor,size: 12,)
                                        :
                                    Icon(Icons.check_circle_outline,color: Colors.green,size: 12,),


                                  ],
                                ),
                              ],
                            ),

                          ],
                        ),
                        Column(
                          children: [
                            // ((dataMap['personalInfo']!=null&&compareDateWithCurrent(dataMap['personalInfo']['validTo'])!="1"&&compareDateWithCurrent(dataMap['personalInfo']['validTo'])!="4")||
                            //     (dataMap['driverLicenseInfo']!=null&&compareDateWithCurrent(dataMap['driverLicenseInfo']['validPeriodTo'])!="1"&&compareDateWithCurrent(dataMap['driverLicenseInfo']['validPeriodTo'])!="4")||
                            //     (dataMap['vehicleDrivingLicenseInfo']!=null&&compareDateWithCurrent(dataMap['vehicleDrivingLicenseInfo']['scrapDate'])!="1"&&compareDateWithCurrent(dataMap['vehicleDrivingLicenseInfo']['scrapDate'])!="4")||
                            //     (dataMap['trailerDrivingLicenseInfo']!=null&&compareDateWithCurrent(dataMap['trailerDrivingLicenseInfo']['scrapDate'])!="1"&&compareDateWithCurrent(dataMap['trailerDrivingLicenseInfo']['scrapDate'])!="4")||
                            //     (dataMap['qualificationCertificateInfo']!=null&&compareDateWithCurrent(dataMap['qualificationCertificateInfo']['expiryDate'])!="1"&&compareDateWithCurrent(dataMap['qualificationCertificateInfo']['expiryDate'])!="4")||
                            //     (dataMap['roadTransportCertificateInfo']!=null&&compareDateWithCurrent(dataMap['roadTransportCertificateInfo']['expiryDate'])!="1"&&compareDateWithCurrent(dataMap['roadTransportCertificateInfo']['expiryDate'])!="4"))
                            //     ?BrnTagCustom(
                            //   tagText: "有证件即将过期",
                            //   textColor: Colors.white,
                            //   fontSize: 9.sp,
                            //   backgroundColor: Colors.red,
                            // ):
                            // ((dataMap['personalInfo']!=null&&compareDateWithCurrent(dataMap['personalInfo']['validTo'])=="4")||
                            //     (dataMap['driverLicenseInfo']!=null&&compareDateWithCurrent(dataMap['driverLicenseInfo']['validPeriodTo'])=="4")||
                            //     (dataMap['vehicleDrivingLicenseInfo']!=null&&compareDateWithCurrent(dataMap['vehicleDrivingLicenseInfo']['scrapDate'])=="4")||
                            //     (dataMap['trailerDrivingLicenseInfo']!=null&&compareDateWithCurrent(dataMap['trailerDrivingLicenseInfo']['scrapDate'])=="4")||
                            //     (dataMap['qualificationCertificateInfo']!=null&&compareDateWithCurrent(dataMap['qualificationCertificateInfo']['expiryDate'])=="4")||
                            //     (dataMap['roadTransportCertificateInfo']!=null&&compareDateWithCurrent(dataMap['roadTransportCertificateInfo']['expiryDate'])=="4"))
                            //     ?BrnTagCustom(
                            //   tagText: "有证件已过期",
                            //   textColor: Colors.white,
                            //   fontSize: 9.sp,
                            //   backgroundColor: Colors.red,
                            // ):SizedBox(height: 0,),
                            GestureDetector(
                                child: Container(
                                  margin: EdgeInsets.only(right: 10.w),
                                  height: 20.h,
                                  width: 88.w,
                                  decoration: BoxDecoration(
                                      color: MyColors.themeColor,
                                      borderRadius: BorderRadius.all(Radius.circular(10))),
                                  child:Column(
                                    mainAxisAlignment: MainAxisAlignment.center,
                                    children: [
                                      Row(
                                        children: [
                                          SizedBox(width: 8.w,),
                                          Image.asset("lib/Images/PersonCenter/钢笔icon.png",width: 13.w,height: 13.h,),
                                          SizedBox(width: 4.w,),
                                          Text(messages["编辑资料"],style: TextStyle(color: Colors.white,fontSize: 11.sp,fontWeight: FontWeight.w600),),
                                          SizedBox(width: 4.w,),
                                          Text(">",style: TextStyle(color: Colors.white,fontSize: 11.sp,fontWeight: FontWeight.w600),),
                                        ],
                                      )
                                    ],
                                  ),
                                ),
                                onTap: () async {
                                  if(dataMap.isNotEmpty){
                                    final result = await  Navigator.push( context, FadeRoute(page:InformationView(dataMap: dataMap, isAdd: false,)));
                                    if (result == null) {
                                      getUserMessage();
                                    }
                                  }

                                }
                            ),

                          ],
                        ),


                      ],
                    ),
                    onTap: ()async{
                      if(dataMap.isNotEmpty){
                        final result = await  Navigator.push( context, FadeRoute(page:InformationView(dataMap: dataMap, isAdd: false,)));
                        if (result == null) {
                          getUserMessage();
                        }
                      }
                    },
                  ),

                  // if (dataMap['personalInfo']==null&&dataMap['driverLicenseInfo']==null&&dataMap['qualificationCertificateInfo']==null&&dataMap['vehicleDrivingLicenseInfo']==null&&dataMap['roadTransportCertificateInfo']==null)
                  // Row(
                  //     mainAxisAlignment: MainAxisAlignment.end,
                  //     children: [
                  //       GestureDetector(
                  //         child: Text("去认证>>",style: TextStyle(color: MyColors.themeColor,fontSize: 12.sp),),
                  //         onTap: () async {
                  //           String? token = await TokenManager.getToken();
                  //           if(token==null) token="";
                  //           Navigator.push( context, FadeRoute(page:IDCardVC(token: token,)));
                  //
                  //         },
                  //       ),
                  //     SizedBox(width: 20.w,)]),
                  SizedBox(height: 20.h,),
                  Container(

                    height: 100.h,
                    margin: EdgeInsets.only(left: 10.w,right: 10.w),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10)),
                    ),
                    child: Column(
                      children: [
                        SizedBox(height: 8.h,),
                        GestureDetector(
                          child:  Row(
                            mainAxisAlignment: MainAxisAlignment.spaceBetween,
                            children: [
                              Row(
                                children: [
                                  SizedBox(width: 8.h,),
                                  Text(messages["我的钱包"],style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black,fontSize: 14.sp),),
                                  Image.asset("lib/Images/PersonCenter/钱包icon.png",width: 17.w,height: 17.h,),
                                ],
                              ),

                              Row(
                                children: [
                                  Text(messages["进入钱包"],style: TextStyle(fontWeight: FontWeight.w600,color: Color.fromRGBO(154, 154, 154, 1),fontSize: 14.sp),),
                                  Icon(Icons.arrow_forward_ios,color: MyColors.authTipColor,size: 14,),
                                  SizedBox(width: 8.h,),
                                ],
                              ),
                            ],
                          ),
                          onTap: (){
                            Navigator.push( context, FadeRoute(page:MyWallet()));
                          },
                        ),


                        SizedBox(height: 8.h,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            SizedBox(width:10.w),
                            Column(
                              children: [
                                checkBill1==1?
                                Text( balanceMap['balance']!=null? balanceMap['balance']:"0.00",style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black,fontSize: 14.sp),)
                                    :Text( "*****",style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black),),
                                Row(
                                  children: [
                                    Text("钱包余额"+"(元)",style: TextStyle(fontSize: 11.sp,color: Color.fromRGBO(154, 154, 154, 1)),),
                                    GestureDetector(
                                      child: checkBill1==1?
                                      Image.asset("lib/Images/PersonCenter/隐藏余额icon.png",width: 14.w,height: 14.h,)
                                          :Image.asset("lib/Images/PersonCenter/显示余额icon.png",width: 14.w,height: 14.h,),
                                      onTap: (){
                                        setState(() {
                                          if (checkBill1==1){
                                            checkBill1=2;
                                          }else{
                                            checkBill1=1;
                                          }
                                        });
                                      },
                                    ),

                                  ],
                                ),

                              ],
                            ),
                            Image.asset("lib/Images/PersonCenter/垂直实线.png",width: 1.w,height: 46.h,),
                            Column(
                              children: [
                                checkBill2==1?
                                Text(balanceMap['freightAmount']!=null? balanceMap['freightAmount']:"0.00",style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black,fontSize: 14.sp),)
                                    :Text( "*****",style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black),),
                                Row(
                                  children: [
                                    Text("待结算运费"+"(元)",style: TextStyle(fontSize: 11.sp,color: Color.fromRGBO(154, 154, 154, 1)),),
                                    GestureDetector(
                                      child: checkBill2==1?
                                      Image.asset("lib/Images/PersonCenter/隐藏余额icon.png",width: 14.w,height: 14.h,)
                                          :Image.asset("lib/Images/PersonCenter/显示余额icon.png",width: 14.w,height: 14.h,),
                                      onTap: (){
                                        setState(() {
                                          if (checkBill2==1){
                                            checkBill2=2;
                                          }else{
                                            checkBill2=1;
                                          }
                                        });
                                      },
                                    ),


                                  ],
                                ),
                              ],
                            ),
                            Image.asset("lib/Images/PersonCenter/垂直实线.png",width: 1.w,height: 46.h,),
                            Column(
                              children: [
                                checkBill3==1?
                                Text(balanceMap['depositAmount']!=null? balanceMap['depositAmount']:"0.00",style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black,fontSize: 14.sp),)
                                    :Text( "*****",style: TextStyle(fontWeight: FontWeight.w600,color: Colors.black),),
                                Row(
                                  children: [
                                    Text("担保订金"+"(元)",style: TextStyle(fontSize: 11.sp,color: Color.fromRGBO(154, 154, 154, 1)),),
                                    GestureDetector(
                                      child: checkBill3==1?
                                      Image.asset("lib/Images/PersonCenter/隐藏余额icon.png",width: 14.w,height: 14.h,)
                                          :Image.asset("lib/Images/PersonCenter/显示余额icon.png",width: 14.w,height: 14.h,),
                                      onTap: (){
                                        setState(() {
                                          if (checkBill2==1){
                                            checkBill3=2;
                                          }else{
                                            checkBill3=1;
                                          }
                                        });
                                      },
                                    ),

                            SizedBox(width:10.w), 
                                  ],
                                ),
                              ],
                            ),
                          ],
                        ),

                      ],
                    ),
                  ),
                  SizedBox(height: 8.h,),
                  Container(
                    padding: EdgeInsets.only(bottom: 10.h),
                    // height: 170.h,
                    margin: EdgeInsets.only(left: 10.w,right: 10.w),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.all(Radius.circular(10)),

                    ),
                    child: Column(
                      children: [
                        SizedBox(height: 8.h,),
                        Row(
                          children: [
                            SizedBox(width: 15.w,),
                            Text(messages["服务大厅"],style: TextStyle(color: Colors.black,fontWeight:FontWeight.w600,fontSize: 14.sp ),)
                          ],

                        ),
                        SizedBox(height: 8.h,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            SizedBox(width: 2.w,),
                            BrnIconButton(
                                name: messages["意见反馈"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/意见反馈icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:FeedBack()));

                                }),
                            BrnIconButton(
                                name: messages["保险"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/保险icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:Insure()));
                                }),
                            BrnIconButton(
                                name: messages["客户服务"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/客户服务icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:CustomerServiceMain()));

                                }),
                            BrnIconButton(
                                name: messages["我的评价"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/我的评价icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:MyEvaluation(userMap: dataMap,)));
                                }),
                            SizedBox(width: 2.w,),

                          ],
                        ),
                        SizedBox(height: 8.h,),
                        Row(
                          mainAxisAlignment: MainAxisAlignment.spaceBetween,
                          children: [
                            SizedBox(width: 2.w,),
                            BrnIconButton(
                                name: messages["黑名单"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/黑名单icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:BlackList()));
                                }),
                            BrnIconButton(
                                name: messages["找油"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/找油icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:FindOil()));
                                }),
                            BrnIconButton(
                                name: messages["车队管理"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/车队管理icon.png"),
                                onTap: () async{
                                  if(dataMap['role']==0&&dataMap['captainId']==null) {
                                    final  result = await Navigator.push(context, FadeRoute(page: FleetManagement(userMap: dataMap,)));
                                    if(result==null){
                                      getUserMessage();
                                    }
                                  }
                                  if(dataMap['role']==1) {
                                    final result =await  Navigator.push(context,
                                        FadeRoute(page: MyFleet(captainId: dataMap['captainId'],)));
                                    if(result!=null){
                                      getUserMessage();
                                    }
                                  }
                                  if(dataMap['role']==0&&dataMap['captainId']!=null) {
                                    final result =await Navigator.push(context,
                                        FadeRoute(page: MyFleet(
                                            captainId: dataMap['captainId'])));
                                    if(result!=null){
                                      getUserMessage();
                                    }
                                  }
                                }),
                            BrnIconButton(
                                name: messages["平台规则"],
                                style: TextStyle(
                                  fontSize: 13.sp,
                                  color: Colors.black,
                                ),
                                direction: Direction.bottom,
                                padding: 4.h,
                                iconHeight: 26.h,
                                iconWidth: 26.w,
                                iconWidget: Image.asset("lib/Images/PersonCenter/平台规则icon.png"),
                                onTap: () {
                                  Navigator.push( context, FadeRoute(page:PlatformRules()));
                                }),
                            SizedBox(width: 2.w,),

                          ],
                        ),
                      ],
                    ),
                  ),
                ],
              )
            ],
          ),
      ),


    );

  }
}
